package cxt.com.recyclerview.demo5;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import cxt.com.recyclerview.R;

/**
 * 作者：chengxiangtong on 2017/1/10 14:53
 * 邮箱：528440900@qq.com
 */

public class NormalAdapter extends RecyclerView.Adapter<NormalAdapter.VH> {
    private List<String> mDatas;

    public NormalAdapter(List<String> mDatas) {
        this.mDatas = mDatas;
    }

    @Override
    public VH onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_5, parent, false);
        return new VH(view);
    }


    @Override
    public void onBindViewHolder(VH holder, int position) {
        holder.text5.setText(mDatas.get(position));
    }

    @Override
    public int getItemCount() {
        return mDatas.size();
    }

    class VH extends RecyclerView.ViewHolder {

        public TextView text5;

        public VH(View itemView) {
            super(itemView);
            text5 = (TextView) itemView.findViewById(R.id.text5);
        }
    }
}
